﻿<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Pragma" content="no-cache">
<link rel="STYLESHEET" type="text/css" id="SkinStyleSheet">
<title>WebNoteEditor</title>
<script language="javascript" type="text/javascript" src="../script/windialog.js"></script>
<script language="javascript">
var selOptions;
window.onload=function()
{
	document.getElementById("InputName").value=srcObj.name;
	document.getElementById("InputSize").value=srcObj.size;
	EditorWindow._FormfocusRadio("radioMultiple",srcObj.multiple.toString(),document);
	selOptions=new EditorWindow._HTMLselect("selectOptions",document);

	document.getElementById("btnAddNode").onclick=__btnAddNode_onclick;
	document.getElementById("btnModifyNode").onclick=__btnModifyNode_onclick;
	document.getElementById("btnRemoveNode").onclick=__btnRemoveNode_onclick;
	document.getElementById("btnSwapUp").onclick=__btnSwapUp_onclick;
	document.getElementById("btnSwapDown").onclick=__btnSwapDown_onclick;
	
	document.getElementById("selectOptions").onclick=__selectOptions_onchange;
	
	AutoResizeDialogWindow();
	
	var i,elems,elem;
	elems=srcObj.options;
	for (i=0;i<elems.length;i++)
	{
		elem=document.createElement("option");
		elem.value=elems[i].value;
		elem.innerText=elems[i].innerText;
		document.getElementById("selectOptions").appendChild(elem);
		elem=null;
	}
	elems=null;

}

function __btnUse_onclick()
{
	var i,elems,elem,sValue;
	srcObj.name=document.getElementById("InputName").value;
	srcObj.size=document.getElementById("InputSize").value;
	sValue=EditorWindow._FormgetRadioValue("radioMultiple",document);
	if (sValue=="true")
		srcObj.multiple=true;
	else
		srcObj.removeAttribute("multiple",true);
	
	elems=srcObj.options;
	for (i=0;i<elems.length;i++)
	{
		elems[i].innerHTML="";
		elems[i].removeNode();
		i--;
	}
	elems=null;
	
	elems=document.getElementById("selectOptions").options;
	for (i=0;i<elems.length;i++)
	{
		elem=XEditor.document.createElement("option");
		elem.value=elems[i].value;
		elem.innerText=elems[i].innerText;
		srcObj.options.appendChild(elem);
		elem=null;
	}
	elems=null;
}


function __btnOk_onclick()
{
	window.returnValue=true;
	selOptions=null;
	window.close();
}


function __btnCancel_onclick()
{
	selOptions=null;
	window.close();
}

function __btnAddNode_onclick()
{
	var elem;
	var returnValue=EditorWindow._showWindialog("dialogs/dialogoption.htm",XEditor.document.body,200,160);
	if (returnValue)
	{
		selOptions.addOption(returnValue[0],returnValue[1]);
	}
}

function __btnModifyNode_onclick()
{

	if (document.getElementById("selectOptions").selectedIndex==-1)
		return;
	var elem;
	var returnValue=EditorWindow._showWindialog("dialogs/dialogoption.htm?optiontext="+document.getElementById("OptionText").value+"&optionvalue="+document.getElementById("OptionValue").value,XEditor.document.body,200,160);
	if (returnValue)
	{
		document.getElementById("selectOptions").options[document.getElementById("selectOptions").selectedIndex].value=returnValue[0];
		document.getElementById("selectOptions").options[document.getElementById("selectOptions").selectedIndex].innerText=returnValue[1];
	}
}

function __btnRemoveNode_onclick()
{
	document.getElementById("selectOptions").options[document.getElementById("selectOptions").selectedIndex].removeNode();
}


function __selectOptions_onchange()
{
	document.getElementById("OptionText").value=document.getElementById("selectOptions").options[document.getElementById("selectOptions").selectedIndex].innerText;
	document.getElementById("OptionValue").value=document.getElementById("selectOptions").options[document.getElementById("selectOptions").selectedIndex].value;
}

function __btnSwapUp_onclick()
{
	if (document.getElementById("selectOptions").selectedIndex>0)
		document.getElementById("selectOptions").children(document.getElementById("selectOptions").selectedIndex).swapNode(document.getElementById("selectOptions").children(document.getElementById("selectOptions").selectedIndex-1));
}

function __btnSwapDown_onclick()
{
	if (document.getElementById("selectOptions").selectedIndex>-1 && document.getElementById("selectOptions").selectedIndex<document.getElementById("selectOptions").length-1)
		document.getElementById("selectOptions").children(document.getElementById("selectOptions").selectedIndex).swapNode(document.getElementById("selectOptions").children(document.getElementById("selectOptions").selectedIndex+1));

}
</script>
</head>

<body class="dialog">
<script language="javascript" type="text/javascript">dialogTitle("lang_select_attribute")</script>

<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><script language="javascript" type="text/javascript">dialogPrintlang("lang_name")</script></td>
    <td><input type="text" id="inputName" size="60" value="" class="dialogInput"></td>
  </tr>
  <tr>
    <td></td>
    <td>
      <table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="50%">
          	<select id="selectOptions" size="10" style="width: 327px; height: 150px" class="dialogInput"></select>
          </td>
          <td width="50%">
            <table border="0" width="100%">
              <tr>
              	<td width="100%" align="center">
	              	<script language="javascript" type="text/javascript">
	              		document.write("<input type=\"button\" value=\""+EditorWindow.lang_add+"\" id=\"btnAddNode\" class=\"SysBTN5\">");
	              		</script>
					</td>
              </tr>
              <tr>
					<td width="100%" align="center">
	              	<script language="javascript" type="text/javascript">
	              		document.write("<input type=\"button\" value=\""+EditorWindow.lang_modify+"\" id=\"btnModifyNode\" class=\"SysBTN5\">");
	              	</script>
					</td>
              </tr>
              <tr>
					<td width="100%" align="center">
	              	<script language="javascript" type="text/javascript">
	              		document.write("<input type=\"button\" value=\""+EditorWindow.lang_delete+"\" id=\"btnRemoveNode\" class=\"SysBTN5\">");
	              	</script>
					</td>
              </tr>
              <tr>
					<td width="100%" align="center">
	              	<script language="javascript" type="text/javascript">
	              		document.write("<input type=\"button\" value=\""+EditorWindow.lang_moveup+"\" id=\"btnSwapUp\" class=\"SysBTN5\">");
	              	</script>
					</td>
              </tr>
              <tr>
					<td width="100%" align="center">
	              	<script language="javascript" type="text/javascript">
	              		document.write("<input type=\"button\" value=\""+EditorWindow.lang_movedown+"\" id=\"btnSwapDown\" class=\"SysBTN5\">");
	              	</script>
					</td>
              </tr>
              <tr>
					<td width="100%"></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <fieldset><legend><script language="javascript" type="text/javascript">dialogPrintlang("lang_option_attribute")</script></legend>
      <table border="0" cellpadding="0">
        <tr>
          <td><script language="javascript" type="text/javascript">dialogPrintlang("lang_value")</script></td>
          <td><input type="text" id="OptionValue" size="58" readonly class="dialogInput"></td>
        </tr>
        <tr>
          <td><script language="javascript" type="text/javascript">dialogPrintlang("lang_text")</script></td>
          <td><input type="text" id="OptionText" size="58" readonly class="dialogInput"></td>
        </tr>
      </table>
      </fieldset>
    </td>
  </tr>
  <tr>
    <td>
    	<script language="javascript" type="text/javascript">dialogPrintlang("lang_height")</script>
    	<input type="text" id="InputSize" size="9" class="dialogInput" datatype="number">
    	&nbsp;&nbsp;
    	<script language="javascript" type="text/javascript">dialogPrintlang("lang_select_multiple")</script>
    	<input type="radio" value="true" name="radioMultiple">
    	<script language="javascript" type="text/javascript">dialogPrintlang("lang_true")</script>
    	<input type="radio" value="false" name="radioMultiple">
    	<script language="javascript" type="text/javascript">dialogPrintlang("lang_false")</script>
    </td>
  </tr>
</table>
<div class="buttons">
	<hr size="1" color="#B3AC9D">
	<script language="javascript" type="text/javascript">
		PrintButtons();
	</script>
</div>


</body>

</html>
